﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ListenMusic.User_ServiceReference;
using System.ServiceModel;
namespace ListenMusic.Models.Reposistory.User
{
    public class UserReposistory
    {
        UserServiceClient userClient;
        public UserReposistory()
        {
            userClient = new UserServiceClient();
        }
        public bool register(Member member)
        {
            try {
                bool rs = userClient.register(member);
                return rs;
            }
            catch (FaultException e) { throw e; }
        }       
        public List<ViewSearch> search(string keyword)
        {
            try
            {
                ViewSearch[] rs = userClient.memberSearch(keyword);                
                return rs.ToList();
            }
            catch (FaultException e) { throw e; }
        }
    }
       
        //public Member checkLogin(string email, string password)
        //{
        //    try
        //    {
        //        return userClient.checkLogin(email, password); 
        //    }
        //    catch (FaultException ex)
        //    {
        //        throw ex;
        //    }
        //}
        //public bool checkEmail(string email)
        //{
        //    try
        //    {
        //        Member member = userClient.checkEmail(email);
        //        if (member.Email == null)
        //        {
        //            return true;
        //        }
        //        else
        //        {
        //            return false;
        //        }
        //    }
        //    catch (FaultException ex)
        //    {
        //        throw ex;
        //    }
        //}       
    }
